<?php


/**
 * Radcodes - SocialEngine Module
 *
 * @category   Application_Extensions
 * @package    Badge
 * @copyright  Copyright (c) 2009-2010 Radcodes LLC (http://www.radcodes.com)
 * @license    http://www.radcodes.com/license/
 * @version    $Id$
 * @author     Vincent Van <vincent@radcodes.com>
 */
 
 
?>

<div class="headline">
  <h2>
    <?php echo $this->translate('Badges');?>
  </h2>
  <div class="tabs">
    <?php
      // Render the menu
      echo $this->navigation()
        ->menu()
        ->setContainer($this->navigation)
        ->render();
    ?>
  </div>
</div>

<div class='layout_right'>
  <?php echo $this->form->render($this) ?>
</div>

<div class='layout_middle badge_layout_middle'>
  
  <?php if( $this->keyword):?>
    <div class="badges_result_filter_details">
      <?php echo $this->translate('Showing badges posted with keyword %s', $this->htmlLink(
        $this->url(array('action'=>'browse','keyword'=>$this->keyword), 'badge_general', true),
        $this->keyword
      ));?>
      <?php echo $this->htmlLink(array('route'=>'badge_general','action'=>'browse'), $this->translate('(x)'))?>
    </div>
  <?php endif; ?>
  
  <?php if( $this->paginator->getTotalItemCount() > 0 ): ?>
  
    <ul class='badges_browse'>
      <?php foreach ($this->paginator as $badge): ?>
        <li>
          <div class="badge_photo">
            <?php echo $this->htmlLink($badge->getHref(), $this->itemPhoto($badge, 'thumb.normal'),
            array('title'=>$badge->getTitle())
            );?>
          </div>
          <div class="badge_info">
            <div class="badge_title">
              <h3><?php echo $this->htmlLink($badge->getHref(), $badge->getTitle()); ?></h3>
            </div>
            <div class="badge_meta">
              <?php echo $this->translate('Posted %s', $this->timestamp($badge->creation_date)); ?>
              -
              <?php $badge_members = $badge->membershipCount(); ?>
            	<?php echo $this->translate(array("%s member", "%s members", $badge_members), $this->locale()->toNumber($badge_members)); ?>
            </div>
            <?php if ($this->notablemember && $badge_members > 0):?>
              <div class="badge_sample_users">
                <?php $badge_sample_users = $badge->getSampleMemberUsers($this->notablemember); ?>
                <?php echo $this->translate('Notable members: %s', $this->fluentList($badge_sample_users)); ?>
              </div>
            <?php endif; ?>
            <div class="badge_desc">
              <?php echo $this->viewMore($badge->getDescription()); ?>
            </div>

          </div>
        </li>
      <?php endforeach; ?>  
    </ul>

  <?php elseif($this->keyword || $this->category || $this->membership_type): ?>
    <div class="tip">
      <span>
        <?php echo $this->translate('There are no badges that match that criteria.');?>
      </span>
    </div>
  <?php else:?>
    <div class="tip">
      <span>
        <?php echo $this->translate('There are no badges available yet.');?>
      </span>
    </div>
  <?php endif; ?>

    <?php echo $this->paginationControl($this->paginator, null, null, array(
      'query' => $this->formValues
    )); ?>    

</div>
